package r25.engine;

import java.text.DateFormat;
import java.util.Date;

import r25.engine.IGameService.GAME_PHASE;
import r25.tools.DateHelper;
import r25.tools.DateHelper.DF;

public class GameStateTimeStamp {
	private final String gameInstanceId;
	private final GAME_PHASE currentGamePhase;
	private final int turn;
	private final int character;
	private final int characterAction;
	private final Date date;
	private final float progress;

	private final DateFormat df = DateHelper.getDateFormat(DF.SIGNED_BEAN);

	public GameStateTimeStamp(String gameInstanceId,
			GAME_PHASE currentGamePhase, int turn, int character,
			int characterAction, Float progress) {
		super();

		this.gameInstanceId = gameInstanceId;
		this.currentGamePhase = currentGamePhase;
		this.turn = turn;
		this.character = character;
		this.characterAction = characterAction;
		this.date = new Date();
		this.progress = progress;
	}

	@Override
	public String toString() {
		return "[" + currentGamePhase + ", T" + turn + ":C" + character + ":A"
				+ characterAction + " @progress "
				+ String.format("%3.2f", progress) + " @time "
				+ df.format(date) + "]";
	}

	public String getGameInstanceId() {
		return gameInstanceId;
	}

	public GAME_PHASE getCurrentGamePhase() {
		return currentGamePhase;
	}

	public int getTurn() {
		return turn;
	}

	public int getCharacter() {
		return character;
	}

	public int getCharacterAction() {
		return characterAction;
	}

	public Date getDate() {
		return date;
	}

	public float getProgress() {
		return progress;
	}
}
